from werkzeug.exceptions import HTTPException
from app.libs.error import APIException

class Success(APIException):
    code = 201
    msg = 'OK'
    error_code = 0
    
class ServerError(APIException):
    code = 500
    msg = 'sorry, we made a mistake (*￣︶￣)!'
    error_code = 999

#class ClientTypeError(HTTPException):
class ClientTypeError(APIException):    
    #400(语法错误) 401(未授权) 403(禁止访问) 
    #404(请求的网页不存在或已被删除)
    #500(服务器异常错误)
    #200(正常完成并返回) 201(已创建) 204(无内容)
    #301(永久移动) 302(临时移动)
    code = 400
    #description = {'client is invalid'}
    msg = 'client is invalid'
    error_code = 1006
    
class ParameterException(APIException):
    code = 400
    msg = 'invalid parameter'
    error_code = 1000
    
class NotFound(APIException):
    code = 404
    msg = 'the resource are not found O__O...'
    error_code = 1001

#用户名或密码不正确    
class AuthFailed(APIException):
    code = 401
    error_code = 1005
    msg = 'authorization failed'